//
//  UIBottom+Extension.swift
//  WeiBoShiBing
//
//  Created by Bingo on 15/11/1.
//  Copyright © 2015年 Bingo. All rights reserved.
//

import UIKit


extension UIButton{

    /**
    快速创建按钮
    - parameter imageName:  图片名称
    - parameter title:      标题
    - parameter titleColor: 标题颜色
    - parameter fontSize:   标题大小
    - returns: 按钮
    */
    convenience init(imageName:String,title:String,textColoc:UIColor,fontSize:CGFloat){
        self.init()
        setTitle(title, forState: UIControlState.Normal)
        
        setTitleColor(textColoc, forState: UIControlState.Normal)
        
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
        
    }
    
    convenience init(bkgImageName: String, title: String, titleColor: UIColor, fontSzie: CGFloat) {
        self.init()
        // 设置背景图片
        setBackgroundImage(UIImage(named: bkgImageName), forState: UIControlState.Normal)
        
        // 设置文字内容
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(titleColor, forState: UIControlState.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSzie)
    }

}